Code
data_raw |>
select(position, age:resident, participation, traffic_light) |>
select(-work_year) |>
mutate(
resident = if_else(resident == 1, "In-campus", "Off-campus"),
participation = case_when(
participation %in% c(0, "0", "No") ~ "No",
participation %in% c(1, "1", "Yes") ~ "Yes",
TRUE ~ as.character(participation)),
traffic_light = case_when(
traffic_light == 0 ~ "No",
traffic_light == 1 ~ "Yes",
traffic_light == 2 ~ "Maybe",
TRUE ~ as.character(traffic_light))
) |>
tbl_summary(
by = position,
type = list(sex ~ "categorical",
participation = "categorical"),
missing_text = "Missing observation(s)"
) |>
bold_labels() %>%
as_kable_extra(linesep = "") %>%
kable_minimal() %>%
kable_styling(full_width = F, fixed_thead = T,
bootstrap_options = c("striped", "hover", "condensed", "responsive"))| Characteristic | faculty N = 20 |
staff N = 20 |
|---|---|---|
| age | 32 (24, 37) | 31 (29, 38) |
| Missing observation(s) | 2 | 0 |
| sex | ||
| 0 | 8 (44%) | 8 (42%) |
| 1 | 10 (56%) | 11 (58%) |
| Missing observation(s) | 2 | 1 |
| resident | ||
| In-campus | 7 (39%) | 3 (16%) |
| Off-campus | 11 (61%) | 16 (84%) |
| Missing observation(s) | 2 | 1 |
| participation | ||
| No | 15 (75%) | 9 (60%) |
| Yes | 5 (25%) | 6 (40%) |
| Missing observation(s) | 0 | 5 |
| traffic_light | ||
| Maybe | 1 (5.6%) | 5 (28%) |
| No | 12 (67%) | 1 (5.6%) |
| Yes | 5 (28%) | 12 (67%) |
| Missing observation(s) | 2 | 2 |
| 1 Median (Q1, Q3); n (%) |
1.4 Social and community safety
Code